package com.ailk.tcm.hffw.android.common.ui.pagerAdapter;

import java.util.List;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;

public class FragmentPagerAdapter extends
		android.support.v4.app.FragmentPagerAdapter {
	private List<? extends Fragment> fragments;
	private List<String> titles;

	public FragmentPagerAdapter(FragmentManager fm, List<? extends Fragment> fragments,
			List<String> titles) {
		super(fm);
		this.fragments = fragments;
		this.titles = titles;
	}

	@Override
	public Fragment getItem(int position) {
		return fragments.get(position);
	}

	@Override
	public int getCount() {
		return fragments.size();
	}

	@Override
	public CharSequence getPageTitle(int position) {
		if(titles != null){
			return titles.get(position);
		}
		return super.getPageTitle(position);
	}
}
